package com.zhmsky.mybatisplus_01.controller;

import com.zhmsky.mybatisplus_01.pojo.User;
import com.zhmsky.mybatisplus_01.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @author zhmsky
 * @date 2021/11/30 0:28
 */
@Controller
public class UserController {
    @Autowired
    private UserService userService;

    @ResponseBody
    @GetMapping("/user")
    public String getUserById(@RequestParam("id") int id){
        User user = userService.getById(id);
        return user.toString();
    }
}
